<template>
  <div style="padding: 10px">
    <Row>
      <Col span="8">
        <Card style="width:100%">
          <tree-info-two @callBackTree="callBackTree"></tree-info-two>
        </Card>
      </Col>
      <Col span="15" offset="1">
        <Card>
          <community-info :companyInfo="companyInfo" :choiceInfo="choiceInfo"></community-info>
        </Card>
        <table-info :companyInfo="companyInfo" :choiceInfo="choiceInfo"></table-info>
      </Col>
    </Row>
  </div>
</template>

<script>
import TreeInfoTwo from '../tree-info'
import CommunityInfo from '../community-info'
import TableInfo from '../new-table-action'
import { newGetCompanyInfo } from '../../../../api/z-new-grid'
export default {
  name: 'index',
  components: { TableInfo, CommunityInfo, TreeInfoTwo },
  data () {
    return {
      severUserInfo: {},
      companyInfo: {},
      choiceInfo: {}
    }
  },
  methods: {
    callBackTree (e) {
      this.choiceInfo = e
    },
    newGetCompanyInfo () {
      let data = {
        id: this.severUserInfo.company_id
      }
      newGetCompanyInfo(data).then(ret => {
        if (ret.data.errcode === 0) {
          this.companyInfo = ret.data.data
          if (Object.keys(this.choiceInfo).length === 0) {
            this.choiceInfo = ret.data.data
          }
        } else {
          this.$Notice.error({ title: '查询失败', desc: ret.data.errmsg })
        }
      })
    }
  },
  mounted () {
    this.severUserInfo = this.$store.state.user.severUserInfo
    this.newGetCompanyInfo()
  }
}
</script>
<style scoped>
</style>
